using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace GNetDesktop
{
    public partial class frmBackground : Form
    {
        public string strSkinName = "";
        public frmBackground()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            strSkinName = "";
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (listSkin.SelectedItem != null)
            {
                strSkinName = listSkin.SelectedItem.ToString();

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }

        private void frmBackground_Load(object sender, EventArgs e)
        {
            string strTemp = Application.StartupPath;
            if (!strTemp.EndsWith("\\")) strTemp += "\\";
            strTemp += "Skin\\";

            if (!Directory.Exists(strTemp)) return;

            DirectoryInfo dr=new DirectoryInfo(strTemp);
            DirectoryInfo[] drs=dr.GetDirectories();
            listSkin.Items.Clear();
            for (int i = 0; i < drs.Length; i++)
            {
                int idx=listSkin.Items.Add(drs[i].Name);
                if (Frame.strBKForder == drs[i].Name) listSkin.SelectedIndex = idx;
            }
        }
    }
}